<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>草稿箱</title>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <link th:href="@{/res/notice/lib/weui.min.css}" rel="stylesheet"/>
    <link th:href="@{/res/notice/css/jquery-weui.css}" rel="stylesheet"/>
    <link th:href="@{/res/notice/css/font-awesome.css?v=4.4.0}" rel="stylesheet"/>
    <link th:href="@{/res/notice/css/common.css}" rel="stylesheet"/>
</head>
<body>
<!--<div class="weui-search-bar">
    <form class="weui-search-bar__form">
        <div class="weui-search-bar__box">
            <i class="weui-icon-search"></i>
            <input type="search" class="weui-search-bar__input open-popup" data-target="#replyPopup" placeholder="搜索"
                   readonly="readonly">
            <a href="javascript:" class="weui-icon-clear" id="searchClear"></a>
        </div>
        <label class="weui-search-bar__label" id="searchText">
            <i class="weui-icon-search"></i>
            <span>搜索</span>
        </label>
    </form>
    <a href="javascript:" class="weui-search-bar__cancel-btn" id="searchCancel">取消</a>
</div>-->

<!-- 搜索Popup -->
<div id="replyPopup" class='weui-popup__container popup-bottom'>
    <div class="weui-popup__overlay">
    </div>
    <div class="weui-popup__modal">
        <div class="toolbar">
            <div class="toolbar-inner">
                <a href="javascript:;" class="picker-button close-popup">关闭</a>
                <h1 class="title">条件查询</h1>
            </div>
        </div>
        <form class="form-horizontal m" id="form-receive-search">
            <div class="modal-content bgwhite">
                <!--关键字keyWord-->
                <div class="weui-cell bgpart mt10">
                    <div class="weui-cell__hd">
                        <label class="weui-label bold">关键字</label>
                    </div>
                    <div class="weui-cell__bd">
                        <input name="keyWord" class="weui-input" type="text" placeholder="请输入">
                    </div>
                </div>
                <!--通知类型noticeType-->
                <div class="weui-cell weui-cell_select weui-cell_select-after bgpart mt10">
                    <div class="weui-cell__hd">
                        <label class="weui-label bold">通知类型</label>
                    </div>
                    <div class="weui-cell__bd">
                        <select class="weui-select" name="noticeType">
                            <option value="">全部</option>
                            <option value="1">普通通知</option>
                            <option value="2">会议通知</option>
                            <option value="3">紧急通知</option>
                        </select>
                    </div>
                </div>
                <!--开始结束时间startTime/endTime-->
                <div class="weui-cell bgpart mt10">
                    <div class="weui-cell__hd">
                        <label class="weui-label bold">开始时间</label>
                    </div>
                    <div class="weui-cell__bd">
                        <input name="startTime" class="weui-input time-input" type="text" placeholder="请输入">
                    </div>
                </div>
                <div class="weui-cell bgpart mt10">
                    <div class="weui-cell__hd">
                        <label class="weui-label bold">结束时间</label>
                    </div>
                    <div class="weui-cell__bd">
                        <input name="endTime" class="weui-input time-input" type="text" placeholder="请输入">
                    </div>
                </div>

                <div class="plr15 ptb10">
                    <a class="w45 weui-btn weui-btn_primary" onclick="toSearch()" style="margin-top: 0;">查询</a>
                </div>
            </div>
        </form>
    </div>
</div>
<div class="hr-line-dashed"></div>
<div th:each="notice : ${notices}" class="weui-cell weui-cell_swiped">
    <div class="weui-cell weui-cell_swiped">
        <div class="weui-cell__bd">
            <div class="weui-cell">
                <div class="weui-cell__hd"><i class="fa fa-envelope blue"></i></div>
                <div class="weui-cell__bd pl10"><p th:text="${notice.noticeTheme}"
                                                   th:onclick="detailSend([[${notice.noticeId}]]);"></p></div>
                <div class="weui-cell__ft ft12"
                     th:text="${#dates.format(notice.noticeSendingTime,'yyyy-MM-dd HH:mm')}"></div>
            </div>
        </div>
        <div class="weui-cell__ft">
            <a class="weui-swiped-btn weui-swiped-btn_warn" href="javascript:"
               th:onclick="delInfo([[${notice.noticeId}]]);">删除</a>
            <a class="weui-swiped-btn weui-swiped-btn_default close-swipeout" href="javascript:">关闭</a>
        </div>
    </div>
</div>

<script th:src="@{/res/notice/lib/jquery-2.1.4.js}"></script>
<script th:src="@{/res/notice/js/jquery-weui.js}"></script>
<script th:src="@{/res/ajax/libs/layer/layer.min.js}"></script>
<script th:src="@{/res/bonorsoft/js/common.js?v=4.2.0}"></script>
<script th:src="@{/res/ajax/libs/layui/layui.js}"></script>
<script th:inline="javascript">
    var token = [[${token}]];
    var prefix = "/mobile/notice";

    // 删除信息
    function delInfo(noticeId) {
        $.confirm("您确定要删除该邮件吗?", "确认删除?", function () {
            //删除
            var config = {
                url: prefix + "/toDelete",
                type: "post",
                dataType: "json",
                data: {"id": noticeId},
                beforeSend: function (request) {
                    request.setRequestHeader("X-Access-Token", token);
                }
            };
            $.ajax(config);
            $.toast("已删除!");
            setTimeout(function () {
                window.location.reload();//刷新当前页面.
            }, 800)
        }, function () {
            console.log("取消删除");
        });
    }

    // 关闭
    $('.close-swipeout').click(function (event) {
        event.stopPropagation();
        $(this).parents('.weui-cell').swipeout('close')
    });


    //详细界面
    function detailSend(id) {
        layer.open({
            type: 2,
            maxmin: true,
            shade: 0.3,
            title: "草稿箱详细",
            fix: false,
            area: [($(window).width()) + 'px', ($(window).height()) + 'px'],
            content: prefix + "/detail/" + id + "?token=" + token,
            skin: 'layui-layer-gray',
        });
    }

</script>
</body>
</html>
